package bs.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import bs.dao.UserDao;
import bs.entity.User;
import bs.service.UserService;

/**
 * 
 * UserServiceImpl:
 *
 * @author 姜治昊
 * @time 2017年11月20日 上午10:22:12
 */
@Service
public class UserServiceImpl implements UserService {

	@Autowired
	private UserDao userDao;
	
	/**
	 * 登录认证
	 */
	@Override
	public User authenticate(User user) {
		// TODO Auto-generated method stub
		if(null != user) {
			String loginName = user.getLoginName();
			String password = user.getPassword();
			if(null != loginName && loginName.length() > 0 && null != password && password.length() > 0) {
				return userDao.getUserByLoginNameAndPassword(user);
			}
		}
		return null;
	}
	
}
